#include <iostream>
#include <vector>

using namespace std;

struct ListNode {
	int val;
	ListNode *next;
	ListNode() : val(0), next(nullptr) {}
	ListNode(int x) : val(x), next(nullptr) {}
	ListNode(int x, ListNode *next) : val(x), next(next) {}	
};

class Solution {
public:
	bool isPalindrome(ListNode* head) {
		if (!head) return false;
		vector<ListNode *> list;
		ListNode *t = head;
		while (t) {
			list.push_back(t);
			t = t->next;
		}
		bool flag = true;
		for (int i = 0,j=list.size()-1; i < j; j--,i++) {
			if (list[i]->val != list[j]->val) {
				flag = false;
				break;
			}
		}
		return flag;
	}
};

void main() {


}